﻿<UserControl x:Class="WPFCABShell.Shell.Visualizers.CommandVisualizer"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
	xmlns:local="clr-namespace:WPFCABShell.Shell.Visualizers">
    <Grid>
		<Grid.RowDefinitions>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="*"/>
			<RowDefinition Height="Auto"/>
			<RowDefinition Height="*"/>
		</Grid.RowDefinitions>
		<Grid.ColumnDefinitions>
			<ColumnDefinition Width="*"/>
		</Grid.ColumnDefinitions>
		
		<Label>Registered Commands:</Label>
		<ListView x:Name="_registeredCommandsListView" Grid.Row="1" ItemsSource="{Binding CommandService.RegisteredCommands}">
			<ListView.View>
				<GridView AllowsColumnReorder="true">
					<GridViewColumn DisplayMemberBinding="{Binding Id}" Header="ID" Width="Auto"/>
					<GridViewColumn DisplayMemberBinding="{Binding Text}" Header="Text" Width="Auto"/>
					<GridViewColumn DisplayMemberBinding="{Binding Path=(local:CommandVisualizer.ExecutionCount), RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListViewItem}}}" Header="Execution Count" Width="100"/>
					<GridViewColumn DisplayMemberBinding="{Binding Path=(local:CommandVisualizer.LastExecutionTimestamp), RelativeSource={RelativeSource FindAncestor, AncestorType={x:Type ListViewItem}}}" Header="Last Executed" Width="Auto"/>
				</GridView>
			</ListView.View>
		</ListView>
		
		<Label Grid.Row="2">Execution History:</Label>
		<ListView Grid.Row="3" ItemsSource="{Binding ExecutionHistory}">
			<ListView.View>
				<GridView AllowsColumnReorder="true">
					<GridViewColumn DisplayMemberBinding="{Binding Command.Id}" Header="ID" Width="100"/>
					<GridViewColumn DisplayMemberBinding="{Binding Command.Text}" Header="Text" Width="100"/>
					<GridViewColumn DisplayMemberBinding="{Binding Timestamp}" Header="Timestamp" Width="100"/>
				</GridView>
			</ListView.View>
		</ListView>
	</Grid>
</UserControl>
